package com.sangeng.controller;

import com.sangeng.domain.OssResult;
import com.sangeng.service.impl.ossService;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import javax.annotation.Resource;

@CrossOrigin
@RestController
public class OssController {

    @Resource
    private  ossService ossService;

    @RequestMapping("/api/upload/image")
    @ResponseBody
    public OssResult test(@RequestParam("file") MultipartFile file){

        try {
            return  ossService.Demo(file);
        } catch (Exception e) {
            e.printStackTrace();
            return  new OssResult(1,"文件上传失败");
        }


    }
}
